﻿using System.Data.Entity.ModelConfiguration;
using RepositoryAndEf.Domain;
using System.Collections;
using System.Collections.Generic;

namespace RepositoryAndEf.Data.Mapping
{
    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            ToTable("Users")
                .HasKey(c => c.Id)
                .HasMany<Order>(u => u.Orders).WithRequired(o => o.Customer);

            HasOptional(c => c.ShoppingCart).WithRequired();
        }
    }
}
